from create import User, Favor, Person, session
# ret = session.query(User, Favor).filter(User.id == Favor.nid).all()
# for item in ret:
#     print("User: %d %s %s\nFavor: %d %s\n" %(item[0].id, item[0].name, item[0].extra, item[1].nid, item[1].caption))

# ret = session.query(Person).join(Favor).all()

ret = session.query(Person).join(Favor, isouter=True).all()
print(ret)